<?php
if(!defined('BZ_XTBLOG') || !defined('BZ_WJSCUZ')) {
	exit('Access Denied');
}
##################################
$user['pwss']='';
$user['pass']='';
$user['smz_name']='';
$user['smz_d']='';
$_config['mysql']['host']='';
$_config['mysql']['user']='';
$_config['mysql']['pass']='';
$_config['mysql']['database']='';
$_config['mysql']['bianma']='';
$_config['mysql']['qianh']='';
$Bingz_adminm='';
##################################
$insert=$_GET['insert'];
$plugin=$db->get_one('plugin',"`identifier` ='$insert' and `available` = '1' ",'');
if(!file_exists(dirname(__FILE__).DIRECTORY_SEPARATOR.$plugin[directory])){
	  $pluginmm='2';
	  $plugin='';
}
##################################
function plugin_Authorize($var){
	global $db,$plugin,$serverip;
	$addon_renminbi_zdh	=substr(md5(substr(md5(md5(''.$plugin[identifier].$serverip.'')),-25,25)),-20,20);
  if($addon_renminbi_zdh == $var){
     return 'ok';
  }
}
    $plugin_password_name_ts='
    <div id="header">
        <h1>('.$plugin[name].')应用未授权</h1>
    </div>
   <div id="container">
   	     <div class="listViewDis2">
            <ul>
             <li><font color="#FF0000">你好！由于应用未授权！不能访问！请联系系统管理员！</font></li>
            </ul>
         </div>
    </div>
    ';

##################################
if($plugin){
   define('BZ_'.$plugin[identifier].'', TRUE);
   $plugin_id=$plugin[identifier];
   $plugin_Address='index.php?'.$Bingz_ml.'=plugin&insert='.$plugin[identifier].'';
   $plugin_Addmm='source/plugin/'.$plugin[identifier].'';
 	 if($plugin[descriptcss]){
	 	  $plugincss='<link href="source/plugin/'.$plugin[directory].''.$plugin[descriptcss].'"rel="stylesheet"type="text/css"/>';
	 }
 	 if($plugin[descriptjs]){
	 	  $pluginjs='<script src="source/plugin/'.$plugin[directory].''.$plugin[descriptjs].'" type="text/javascript" ></script>';
	 }
###############################访问主题
   $mod  =$_GET['mod'];
   if(!$mod){ $mod='index'; }
   $pluginfile='source/plugin/'.$plugin[directory].'source/'.$mod.'.php';
   if(file_exists($pluginfile)){
      require_once $pluginfile;
   }else{
	    echo "err:404</br>Bingz:plugin-1(Failed to load file)";
      Bingz_Error_Reporting('Bingz:plugin-1(Failed to load file)','插件'); 
   }
   $wzxx_title =$plugin_title.$wzxx_title;
   $wzxx_gj    =$plugin_keywords.$wzxx_gj;
   $wzxx_ms    =$plugin_description.$wzxx_ms;
   ############
   if(!$templateshead){@include template('head');}
   ############
   if($templatesplugin){
 	    $pltugitnfile='source/plugin/'.$plugin[identifier].'/templates/'.$templatesplugin.'';
      if(file_exists($pltugitnfile)){
         @include template('plugin#'.$plugin[identifier].'#'.$templatesplugin.'');
      }else{
         Bingz_Error_Reporting('Bingz:plugin-2(Failed to load template','插件'); 
	       echo "err:404</br>Bingz:plugin-2(Failed to load template)";
      }
   }
   ############
   if(!$templatesfoot){@include template('foot');}
###############################
}else{
	 if($pluginmm){
	 	  $pdid='2';
	 }else if($pid){
	 	  $pdid='1';
	 }else{
	 	  $sql=$db->query('plugin',"`available` = '1' and `adminid` = '0'");
      while($row=mysql_fetch_array($sql)){
          if($row[description]){$mm='<img src="source/plugin/'.$row[directory].$row[description].'" width="60" height="60" />';}
	        $plugin[]= array("id"=>"$row[identifier]","name"=>"$row[name]","logo"=>"$mm","namej"=>"$row[descript]");
      }
	 }
   @include template('head');
   @include template('plugin/plugin_index');
   @include template('foot');
}
?>